﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using CMISLibrary.Entities;
using BCNPCObject.DB;

namespace BCNPCObject
{
    public class cls_NPC_HDON_TKHOAN_Controller
    {
        #region   Atributes

        private DataSet CMIS_Header = new CMISOutputParameter();
        private DataSet ds = new DataSet();
        private DataTable dt = new DataTable();
        private NPC_HDON_TKHOAN info;

        #endregion

        #region   Constructor

        public cls_NPC_HDON_TKHOAN_Controller()
        {
            info = new NPC_HDON_TKHOAN();
        }
        public cls_NPC_HDON_TKHOAN_Controller(NPC_HDON_TKHOAN Info)
        {
            this.info = Info;
        }

        #endregion

        #region   Properties

        public NPC_HDON_TKHOAN pInfor
        {
            get { return info; }
            set { info = value; }
        }

        #endregion

        #region   Methods

       
        public bool update_NPC_HDON_TKHOAN_CHAMNO()
        {
            try
            {
                NPC_HDON_TKHOAN obNPC_HDON_TKHOAN = CMIS2.DB.NPC_HDON_TKHOAN.Single(c => c.MA_DVIQLY == info.MA_DVIQLY && c.MA_GD == info.MA_GD && c.ID_HDON == info.ID_HDON);
                obNPC_HDON_TKHOAN.TINH_TRANG = 1;
                obNPC_HDON_TKHOAN.NGUOI_SUA = info.NGUOI_SUA;
                obNPC_HDON_TKHOAN.NGAY_SUA = DateTime.Now;
                return true;
            }
            catch
            {
                CMIS2.ResetDB(); return false;
            }
        }
        public bool update_NPC_HDON_TKHOAN_CHAMNO_CANCEL()
        {
            try
            {
                NPC_HDON_TKHOAN obNPC_HDON_TKHOAN = CMIS2.DB.NPC_HDON_TKHOAN.Single(c => c.MA_DVIQLY == info.MA_DVIQLY && c.MA_GD == info.MA_GD && c.ID_HDON == info.ID_HDON);
                obNPC_HDON_TKHOAN.TINH_TRANG = 0;
                obNPC_HDON_TKHOAN.NGUOI_SUA = info.NGUOI_SUA;
                obNPC_HDON_TKHOAN.NGAY_SUA = DateTime.Now;
                return true;
            }
            catch
            {
                CMIS2.ResetDB(); return false;
            }
        }
        public bool update_NPC_HDON_TKHOAN_CHAMNO_ERRO()
        {
            try
            {
                NPC_HDON_TKHOAN obNPC_HDON_TKHOAN = CMIS2.DB.NPC_HDON_TKHOAN.Single(c => c.MA_DVIQLY == info.MA_DVIQLY && c.MA_GD == info.MA_GD && c.ID_HDON == info.ID_HDON);
                obNPC_HDON_TKHOAN.MA_ERRO = info.MA_ERRO;
                return true;
            }
            catch
            {
                CMIS2.ResetDB(); return false;
            }
        }

       
        # endregion
    }
}
